﻿@{
    ViewBag.Title = "新增、编辑职员";
}
@model DotNet.Model.MyEntity.Base_Staff     
<script src="/Scripts/jQuery/jquery.validate.min.js" type="text/javascript"></script>
<script src="/Scripts/jQuery/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<script type="text/javascript">
    var ckIsCreateUser = false;
    $(document).ready(function () {
        $("#form_Permission_Organize_createStaff").submit(function () {
            return false;
        });
        $("#ckIsCreateUser").click(function () {
            if (this.checked) {
                $("#txtUserName").attr("disabled", "");
                $("#drpRole").attr("disabled", "");
                $("#txtUserPassword").attr("disabled", "");
                $("#txtConfirmPassword").attr("disabled", "");
                ckIsCreateUser = true;
            }
            else {
                $("#txtUserName").attr("disabled", "disabled");
                $("#drpRole").attr("disabled", "disabled");
                $("#txtUserPassword").attr("disabled", "disabled");
                $("#txtConfirmPassword").attr("disabled", "disabled");
                ckIsCreateUser = false;
            }
        });
    });

    function selectRole() {
        //弹出角色选择框
        if (ckIsCreateUser) {
            $.pdialog.open("/Permission/Role/SelectRole/0", "rel_Permission_Role_SelectRole", "选择角色", { "width": "200", "height": "360", "mask": "true" });
        }
    }
</script>
<div class="pageContentD">
    @{Html.EnableClientValidation();}
    @using (Html.BeginForm("StaffCreating", "Organize", null, FormMethod.Post, new { onsubmit = "return validateCallback(this,CreatStaffAdded_Permission_Organize);", @id = "form_Permission_Organize_createStaff", @class = "pageForm" }))
    {   
        <div class="pageFormContent" layouth="60">
            <table width="95%" class="tab01">
                <tr>
                    <td class="td1">
                        <label>
                            姓名：</label>
                    </td>
                    <td>
                        @Html.Raw(Model == null || Model.Id == null ? "" : "<input type=\"hidden\" value=\"" + Model.Id + "\" id=\"Id\" name=\"Id\" />")
                        @Html.TextBoxFor(m => m.RealName, new Dictionary<string, object> { { "alt", "请输入姓名" } })
                        @Html.ValidationMessageFor(m => m.RealName)
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            性别：</label>
                    </td>
                    <td>
                        @Html.DropDownListFor(m => m.Gender, new SelectList(ViewBag.GenderList as System.Collections.IEnumerable, "GID", "Gname"), "--请选择性别--")
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            公司：</label>
                    </td>
                    <td>
                        <span style="float: left">
                            <input type="hidden" id="CompanyId" name="CompanyId" value="@ViewBag.CompanyId" />
                            @*@Html.HiddenFor(m => m.CompanyId)*@
                            <input type="text" id="txtCompanyName" name="CompanyName" value="@ViewBag.CompanyName" onkeydown="return false;"  readonly="readonly"/></span>
                        @*取消选择公司 WS 2011.10.24*@ @*<a class="button" href="/Permission/Organize/SelectOrganize/3_3" target="dialog" rel="dialog_permisson_Organize_createStaff1" title="请选择公司..." mask="true" width="280" height="350"><span>选择</span></a>*@
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            部门：</label>
                    </td>
                    <td>
                        <span style="float: left">
                            <input type="hidden" id="DepartmentId" name="DepartmentId" value="@ViewBag.DepartmentId" />
                            @*@Html.HiddenFor(m => m.DepartmentId)*@
                            <input type="text" id="txtDepartmentName" name="DepartName" value="@ViewBag.departName " onkeydown="return false;"  readonly="readonly"/></span>
                        @*取消选择部门 WS 2011.10.24*@ @*<a class="button" href="/Permission/Organize/SelectOrganize/4_2" target="dialog" rel="dialog_permisson_Organize_createStaff2" title="请选择部门..." mask="true" width="280" height="350"><span>选择</span></a>*@
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            岗位：</label>
                    </td>
                    <td>
                        <span style="float: left">
                            <input type="hidden" id="DutyId" name="DutyId" value="@ViewBag.DutyId" />
                            @*@Html.HiddenFor(m => m.DutyId)*@
                            <input type="text" id="txtDutyName" value="@ViewBag.dutyName" onkeydown="return false;" readonly="readonly" /></span>
                        @*取消选择岗位 WS 2011.10.24*@ @* <a class="button" href="/Permission/Organize/SelectOrganize/5_1" target="dialog" rel="dialog_permisson_Organize_createStaff3" title="请选择岗位..." mask="true" width="280" height="350"><span>选择</span></a>*@
                    </td>
                </tr>
                @*取消选择工作组 WS 2011.10.24*@ @*<tr>
                <td class="td1">
                    <label>
                        工作组：</label>
                </td>
                <td>
                  <span style="float:left">
                    @Html.HiddenFor(m => m.WorkgroupId)
                    <input type="text" id="txtWorkgroupName" value="" onkeydown="return false;" /></span>
                    <a class="button" href="/Permission/Organize/SelectOrganize/6_2" target="dialog" rel="dialog_permisson_Organize_createStaff4" title="请选择工作组..." mask="true" width="280" height="350"><span>选择</span></a>
                </td>
            </tr>*@
                <tr>
                    <td class="td1">
                        <label>
                            编号：</label>
                    </td>
                    <td>
                        @Html.TextBoxFor(m => m.Code)
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            职称：</label>
                    </td>
                    <td>
                        @Html.DropDownListFor(m => m.TitleId, new SelectList(ViewBag.TitleList as System.Collections.IEnumerable, "TID", "Tname"), "--请选择职称--")
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            电子邮件：</label>
                    </td>
                    <td>
                        @Html.TextBoxFor(m => m.Email)
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            手机：</label>
                    </td>
                    <td>
                        @Html.TextBoxFor(m => m.Mobile)
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            QQ：</label>
                    </td>
                    <td>
                        @Html.TextBoxFor(m => m.OICQ)
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                        </label>
                    </td>
                    <td align="center">
                        <input type="checkbox" name="Enabled" id="Enabled" value='1' @Html.Raw(Model == null || Model.Enabled == null ? "checked='checked'" : (Model.Enabled == 1 ? "checked='checked'" : "")) />有效
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            备 注：</label>
                    </td>
                    <td>
                        @Html.TextAreaFor(m => m.Description)
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            是否同时创建账号：</label>
                    </td>
                    <td>
                        <input id="ckIsCreateUser" name="IsCreateUser" type="checkbox" />
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            用户名：</label>
                    </td>
                    <td>
                        <input id="txtUserName" name="UserName" type="text" disabled="disabled" />
                        @*@Html.TextBoxFor(m => m.UserName) @Html.ValidationMessageFor(m => m.UserName)*@
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            默认角色</label>
                    </td>
                    <td>
                        <input type="hidden" id="roleIDs_Permission_Organize_CreateStaff" name="RoleIDs" />
                        <input id="roleNames_Permission_Organize_CreateStaff" name="RoleNames" type="text"
                            disabled="disabled" readonly="readonly" />
                        <a class="button" href="javascript:selectRole();"><span>选择</span></a>
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            密 码：</label>
                    </td>
                    <td>
                        <input id="txtUserPassword" name="UserPassword" type="password" disabled="disabled" />
                        @*@Html.Password("UserPassword", "", new Dictionary<string, object> { { "id", "UserPassword" } })*@
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <label>
                            确认密码：</label>
                    </td>
                    <td>
                        <input id="txtConfirmPassword" name="ConfirmPassword" type="password" disabled="disabled" />
                        @*@Html.Password("tUserPassword", "", new Dictionary<string, object> { { "id", "tUserPassword" } })*@
                    </td>
                </tr>
            </table>
        </div>

        <div class='formBar'>
            <ul>
                <li>
                    <button type="submit" class="btn btn-success btn-sm" id="btnSave_permission_Organize_createStaff">
                        保存</button>
                </li>
                <li>
                    <button type="button" class="close btn btn-default btn-sm">
                        取消</button>
                </li>
            </ul>
        </div>        
    }
    @*</form>*@
</div>
